'use strict';
/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  /**
   * 后台管理
   */
  router.post('/api/upload/file', controller.uploadcos.file);
  router.post('/api/user/login', controller.user.login);
  router.get('/api/user/list', controller.user.allList);
  router.resources('user', '/api/user', controller.user);
  router.get('/api/menu/list', controller.menu.allList);
  router.resources('menu', '/api/menu', controller.menu);
  router.get('/api/dept/list', controller.dept.allList);
  router.resources('dept', '/api/dept', controller.dept);
  router.get('/api/role/list', controller.role.allList);
  router.resources('role', '/api/role', controller.role);

  /**
   * 业务代码
   */
  // 小程序金刚区菜单
  router.get('/api/wxMenu/list', controller.wxMenu.allList);
  router.resources('wxMenu', '/api/wxMenu', controller.wxMenu);
  // 轮播图
  router.get('/api/wxBanner/list', controller.wxBanner.allList);
  router.resources('wxBanner', '/api/wxBanner', controller.wxBanner);
  // 新闻
  router.get('/api/wxNews/list', controller.wxNews.allList);
  router.resources('wxNews', '/api/news', controller.wxNews);
};
